package com.javasm.duanju.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javasm.duanju.dao.DraftVideoItemDao;
import com.javasm.duanju.dto.VideoUploadDTO;
import com.javasm.duanju.entity.DraftVideoItem;
import com.javasm.duanju.service.DraftVideoItemService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * (DraftVideoItem)表服务实现类
 *
 * @author makejava
 * @since 2025-02-26 19:30:09
 */
@Service("draftVideoItemService")
public class DraftVideoItemServiceImpl extends ServiceImpl<DraftVideoItemDao, DraftVideoItem> implements DraftVideoItemService {


    @Override
    public void addVideo(List<VideoUploadDTO> videoUploadDTO) {
        ArrayList<DraftVideoItem> draftVideoItems = new ArrayList<>();
//        循环
        for (VideoUploadDTO uploadDTO : videoUploadDTO) {
            DraftVideoItem draftVideoItem = new DraftVideoItem();
            draftVideoItem.setId(uploadDTO.getItemId());
            draftVideoItem.setVideoUrl(uploadDTO.getItemUrl());
            draftVideoItems.add(draftVideoItem);
        }
        this.updateBatchById(draftVideoItems);
    }
}

